package com.xingkeduo.business.user.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.bind.annotation.*;

import com.xingkeduo.business.transformation.json.JobseekerAssessJTO;
import com.xingkeduo.business.transformation.json.JobseekerAssessRateJTO;
import com.xingkeduo.business.user.domain.AssessmentDomain;
import com.xingkeduo.pojo.table.JobseekerAssessTO;
import com.xingkeduo.util.pojo.base.BaseController;
import com.xingkeduo.util.tool.ReturnUtil;

/**
 * 
 * @author 高杰
 * @time 2018年12月24日 下午5:40:05
 * @description
 */
//@CrossOrigin
@RestController
@RequestMapping("/assess/craftsman")
public class AssessCraftsmanController extends BaseController {
	@Autowired
	private AssessmentDomain assessmentDomain;

	/**
	 * 初试、复试、毕业考核接口
	 * 
	 * @author 高杰
	 * @time 2018年12月29日 上午11:50:30
	 * @param body
	 * @return
	 */
	@RequestMapping(value = "", method = RequestMethod.POST)
	public String doPost(@RequestBody String body, ServerHttpRequest request) {
		returnUtil = new ReturnUtil();
		try {
			JobseekerAssessTO assess = JobseekerAssessJTO.createTableForNew(body);
			assess.setRates(JobseekerAssessRateJTO.createTablesForNew(body));
//			assessmentDomain.assess(assess, 1);
			assessmentDomain.assessCraftsman(assess, getOperator(request));
			return returnUtil.getSuccess();
		} catch (Throwable t) {
			return dealException(t, returnUtil);
		}
	}
}
